<?php Session::Set("URLSENDMAIL", "index.php?" . $_SERVER['QUERY_STRING']);?>
<form name="form1" id="form1" action="" method="post" enctype="multipart/form-data">
<input type="hidden" name="itemID" value="" />
<input type="hidden" name="mode" value="" />
<input type="hidden" name="type" value="" />
<table width="100%" border="0" cellpadding="5" cellspacing="2" class="list">
<tbody>
  <tr>
  	<td colspan="5">
  		<fieldset style="border:1px solid #999;">
  			<legend><b>Chọn danh mục tương ứng</b></legend>
  			<?php echo FunctionCommon::makeSelectHTML($this->danhMucA, "danhmuc", $this->danhmucid, false, "index.php?m=home&danhmucid=", true);?>
  		</fieldset>
	</td>
  </tr>
  <tr>
  	<td colspan="5">
  		<fieldset style="border:1px solid #999;">
  			<legend <?php if(count($this->categoryA)>0) {echo "style='color:#F00;'";}?>><b>Chọn những thể loại tương ứng</b></legend>
  			<?php echo FunctionCommon::makeSelectHTML($this->categoryA, "category", $this->iddm, false, "index.php?m=home&danhmucid=" . $this->danhmucid . "&iddm=", true);?>
  		</fieldset>
	</td>
  </tr>
  <tr>
  	<td colspan="5">
  		<fieldset style="border:1px solid #999;">
  			<legend <?php if(count($this->sCategoryA)>0) {echo "style='color:#F00;'";}?>><b>Chọn những thể loại tương ứng</b></legend>
  			<?php echo FunctionCommon::makeSelectHTML($this->sCategoryA, "scategory", $this->subiddm, false, "index.php?m=home&danhmucid=" . $this->danhmucid . "&iddm=" . $this->iddm . "&subiddm=", true);?>
  		</fieldset>
	</td>
  </tr>
  <tr>
  	<td colspan="5">
		<span style="font-weight:bold;">Số lượng sản phẩm hiện có : <span style="color:#F00;"><?php echo count($this->ArSanPham);?></span> sản phẩm</span>
	</td>
  </tr>
  <tr>
    	<td align="right" colspan="5"><a href="#thongkebottom">▼</a></td>
  </tr>
  <tr id="topHome">
    <th width="2%" align="center" class="color-tr-tds">STT</th>
    <th align="left"><span style="cursor:pointer;" onclick="hrefLocation('index.php?m=home&a=index&danhmucid=<?php echo $this->danhmucid; ?>&iddm=<?php echo $this->iddm;?>&subiddm=<?php echo $this->subiddm;?>&sort=d.name&value=<?php echo ($this->valueSort=='DESC') ? "ASC" : "DESC";?>', '', '<?php echo constants::$pathUrl;?>#topHome')">Thể loại sản phẩm</span></th>
    <th align="left"><span style="cursor:pointer;" onclick="hrefLocation('index.php?m=home&a=index&danhmucid=<?php echo $this->danhmucid; ?>&iddm=<?php echo $this->iddm;?>&subiddm=<?php echo $this->subiddm;?>&sort=c.name&value=<?php echo ($this->valueSort=='DESC') ? "ASC" : "DESC";?>', '', '<?php echo constants::$pathUrl;?>#topHome')">Sản phẩm</span></th>
    <th align="center" class="color-tr-tds"><span style="cursor:pointer;" onclick="hrefLocation('index.php?m=home&a=index&danhmucid=<?php echo $this->danhmucid; ?>&iddm=<?php echo $this->iddm;?>&subiddm=<?php echo $this->subiddm;?>&sort=s.name&value=<?php echo ($this->valueSort=='DESC') ? "ASC" : "DESC";?>', '', '<?php echo constants::$pathUrl;?>#topHome')">Tên sản phẩm</span></th>
    <th width="15%" align="center" class="color-tr-tds"><span style="cursor:pointer;" onclick="hrefLocation('index.php?m=home&a=index&danhmucid=<?php echo $this->danhmucid; ?>&iddm=<?php echo $this->iddm;?>&subiddm=<?php echo $this->subiddm;?>&sort=soluong&value=<?php echo ($this->valueSort=='DESC') ? "ASC" : "DESC";?>', '', '<?php echo constants::$pathUrl;?>#topHome')">Số lượng</span></th>
   </tr id="thongketop">
   <?php if (count ($this->ArSanPham) > 0) {
   		$i=0;
   		foreach ($this->ArSanPham as $sanpham) {
   ?>
	   <tr class="<?php if ($i%2==0) echo 'blue'; else echo 'white'; if ($sanpham['danhmuc_id'] > 1) {echo " danhmucidmax";}?>">
	     <td align="center"><?php echo ($i+1);?></td>
	     <td align="left"><?php echo $sanpham['nameD'];?></td>
	     <td align="left"><?php echo $sanpham['nameC'];?></td>
	     <?php if ($sanpham['danhmuc_id'] == '1') :?>
	     <td align="left" onclick="frmSubmit('m=khohang&a=index&danhmucid=<?php echo $this->danhmucid; ?>&iddm=<?php echo $this->iddm;?>&subiddm=<?php echo $this->subiddm;?>&idSP=<?php echo $sanpham['id'];?><?php echo constants::$pathUrl;?>', '<?php echo $sanpham['id']; ?>', '', '')">
   			<?php echo $sanpham['nameS'];?>
	     </td>
	     <?php else :?>
	     <td align="left" onclick="frmSubmit('m=sanpham&a=edit&danhmucid=<?php echo $sanpham['danhmuc_id']; ?>&iddm=<?php echo $sanpham['iddm'];?>&subiddm=<?php echo $sanpham['iddmc'];?>&idSP=<?php echo $sanpham['id'];?><?php echo constants::$pathUrl;?>', '<?php echo $sanpham['id']; ?>', '', '')">
   			<?php echo $sanpham['nameS'];?>
	     </td>
	     <?php endif;?>
	     <td align="center"><?php echo $sanpham['soluong'];?></td>
	   </tr>
   <?php 
   		$i++;
   		}
   }
   ?>
   	<tr>
    	<td align="right" colspan="5" id="thongkebottom"><a href="#thongketop">▲</a></td>
    </tr>
</tbody>
</table>
</form>